package com.yulan.bankback.mapper.admin;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yulan.bankback.entity.dto.admin.ViolationRegionDto;
import com.yulan.bankback.entity.model.admin.ViolationUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface ViolationUserMapper extends BaseMapper<ViolationUser> {


    @Select("select city, count(*) as count from violation_user where " +
            "violation_time > NOW() - INTERVAL ${interval} group by city limit #{limit}")
    List<ViolationRegionDto> getRegionGroup(@Param("interval") String interval ,
                                            @Param("limit") Integer limit);

    @Select("select * from violation_user where violation_time > NOW() - INTERVAL ${interval}")
    List<ViolationUser> getViolationUserInterval(@Param("interval") String interval);
}
